﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hired.employer
{
    public partial class manage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.IsInRole("company"))
            {
                eds.WhereParameters[0].DefaultValue = DBCompanyAccount.RetrieveCompanyAccount(User.Identity.Name, false).CAccountID;
            }
            if (User.IsInRole("employer"))
            {
                EmployerPassport ep = DBEmployerPassport.RetrieveEmployerPassport(User.Identity.Name);

                if ((bool)ep.Administrator)
                {
                    eds.WhereParameters[0].DefaultValue = DBCompanyAccount.RetrieveCompanyAccountByEmployerID(User.Identity.Name, false).CAccountID;
                }
                else
                {
                    Response.Redirect("../home.aspx");
                }
            }
        }

        protected bool BindAdministrator(string administrator)
        {
            if (administrator == "Y")
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        protected void gvQuestions_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DBEmployerPassport.DeleteEmployerPassportById(e.CommandArgument.ToString());
            }
        }
    }
}